package cn.huanba.client;

import cn.huanba.entity.Dock;
import cn.huanba.entity.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * (Product)表服务接口
 *
 * @author makejava
 * @since 2021-01-07 17:23:27
 */
@FeignClient(name = "huanba-provider")
public interface ProductService {
    @RequestMapping("product/getProductAndDock")
    List<Product> getProductAndDock(@RequestParam("uid") Integer uid);

    @RequestMapping("product/saveDock")
    int saveDock(@RequestBody Dock dock);

    @RequestMapping("product/getProductListByTid")
    List<Product> getProductListByTid(@RequestParam("tid")Integer tid);

    @RequestMapping("product/getProductListByUser")
    List<Product> getProductListByUser(@RequestParam("uid")Integer uid);

    @RequestMapping("product/queryAllByproductName")
    List<Product> queryAllByproductName(@RequestParam("productName")String productName);

    /**
     * 通过ID查询单条数据
     *
     * @param pid 主键
     * @return 实例对象
     */
    @RequestMapping("product/queryById")
    Product queryById(@RequestParam("pid") Integer pid);

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit  查询条数
     * @return 对象列表
     */
    @RequestMapping("product/queryAllByLimit")
    List<Product> queryAllByLimit(@RequestParam("offset") int offset, @RequestParam("limit") int limit);

    /**
     * 新增数据
     *
     * @param product 实例对象
     * @return 实例对象
     */
    @RequestMapping("product/insert")
    int insert(@RequestBody Product product);

    /**
     * 修改数据
     *
     * @param product 实例对象
     * @return 实例对象
     */
    @RequestMapping("product/update")
    Product update(@RequestBody Product product);

    /**
     * 通过主键删除数据
     *
     * @param pid 主键
     * @return 是否成功
     */
    @RequestMapping("product/deleteById")
    boolean deleteById(@RequestParam("pid") Integer pid);

}